package com.gml.jdk.lambda;

/**
 * @ClassName : LambdaTest
 * @Description : 基础使用
 * @Author : gml
 * @Date: 2020-10-22 18:01
 */
public class LambdaTest {

    private interface Calculate{
        int calculate(int a, int b);
    }

    public static void main(String[] args) {
        Calculate calculate = (a, b) -> calculate(a, b);
        Calculate calculate1 = LambdaTest::calculate;
        System.out.println(calculate.calculate(1, 2));
    }

    private static int calculate(int a, int b){
        if (a > b){
            return a - b;
        }else if(a < b){
            return b - a;
        }
        return a + b;
    }
}
